﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PACKETPARSERMAX20.CORE;

namespace PACKETPARSERMAX20.CORE
{
    public class DBCDatabase : DataAccessBase
    {
        public DBCDatabase(string db, bool arg)
            : base(db,arg)
        {
        }

        public List<uint> ValidAuraSpellIDList()
        {
            List<uint> result = new List<uint>();
            ////string command = "SELECT id,name,description,Field72,Field73,Field74 from spell where (Field72 = '6' and Field73 = '0' and Field74 = '0'   )  or  (Field72 = '6' and Field73 = '6' and Field74 = '0'  ) or (Field72 = '6' and Field73 = '6' and Field74 = '6'  )";

            //string command = "SELECT id from spell where (Field72 = '6' and Field73 = '0' and Field74 = '0'   )  or  (Field72 = '6' and Field73 = '6' and Field74 = '0'  ) or (Field72 = '6' and Field73 = '6' and Field74 = '6'  )";
            //using (var datatable = base.ExecuteGetDataTable(command))
            //{
            //    foreach (System.Data.DataRow row in datatable.Rows)
            //        result.Add(uint.Parse(row[0].ToString()));
            //}

            return result;
        }

        public SortedList<uint, byte> ValidAuraSpellIDEffectList()
        {
            SortedList<uint, byte> result = new SortedList<uint, byte>();
            ////string command = "SELECT id,name,description,Field72,Field73,Field74 from spell where (Field72 = '6' and Field73 = '0' and Field74 = '0'   )  or  (Field72 = '6' and Field73 = '6' and Field74 = '0'  ) or (Field72 = '6' and Field73 = '6' and Field74 = '6'  )";

            //string command = "SELECT id, Field72, Field73, Field74 from spell where (Field72 = '6' and Field73 = '0' and Field74 = '0'   )  or  (Field72 = '6' and Field73 = '6' and Field74 = '0'  ) or (Field72 = '6' and Field73 = '6' and Field74 = '6'  )";
            //using (var datatable = base.ExecuteGetDataTable(command))
            //{
            //    foreach (System.Data.DataRow row in datatable.Rows)
            //    {
            //        var id = uint.Parse(row[0].ToString());

            //        result.Add(id, 0);

            //        if ((long)row[2] != 0)
            //        {
            //            result[id] = 1;

            //            if ((long)row[3] != 0)
            //                result[id] = 2;
            //        }
            //    }
            //}

            return result;
        }

         
    }
}
